Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

Commit

Permalink
Handle classifiers, extensions and realm-based authentication (#34,#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
ysb33r committed May 8, 2019
1 parent 4cf9051 commit 30ddd3e
Show file tree
Hide file tree
Showing 22 changed files with 235 additions and 14 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
= CHANGELOG
:issue: link:https://github.com/ysb33r/ivypot-gradle-plugin/issues/
:contributor: link:https://github.com/

== 0.10 - Roadmap

=== Improvements

* {issue}29[#29] Added realm parameter for credentials (Thank you Jakob Hendeß).
* {issue}34[#34] Resolve classifiers and extensions correctly.
* {issue}40[#40] Run repository synchronisation process in separate JVM.
* {issue}41[#41] Allow arbitrary binaries to be cached.
Expand All @@ -13,6 +15,10 @@

* Not binary compatible with 0.9.

=== Contributors

* {contributor}jhendess[Jakob Hendeß]

== 0.9

=== Compatibility
Expand Down
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ NOTE: Also see `src/gradleTest/multiProject` as an example of how this works. (T

== Caching arbitrary binaries

As from 0.10 it is now possible to cache arbitrary binarie files with a path that typically matches that on the server. This is especially useful for people that need to perform tests where binaries are downloaded many times.
As from 0.10 it is now possible to cache arbitrary binary files with a path that typically matches that on the server. This is especially useful for people that need to perform tests where binaries are downloaded many times.

=== Configuring binary repositories

Expand Down
12 changes: 11 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,15 @@ license {
groovy = 'DOUBLESLASH_STYLE'
}
ext.year = '2013-2019'
excludes(['**/*.ad', '**/*.asciidoc', '**/*.adoc', '**/*.md', '**/*.properties', '**/*CompatibilitySpec.groovy'])
excludes([
'**/*.ad',
'**/*.asciidoc',
'**/*.adoc',
'**/*.md',
'**/*.properties',
'**/*.dsl.groovySpec.groovy',
'**/*.dsl.kotlinSpec.groovy',
])
}

pluginBundle {
Expand Down Expand Up @@ -147,6 +155,8 @@ gradleTest {
if (OS.windows) {
gradleArguments '-g', file("${buildDir}/gradleTest/userHome").absolutePath.replaceAll(~$/\\/$, '/')
}

mustRunAfter test, integrationTest, remoteTest
}

task release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ class OfflineRepositorySyncIntegrationSpec extends Specification {
build()

then:
file_exists 'com.android.support.constraint/constraint-layout/1.0.2/constraint-layout-1.0.2.aar'
file_exists 'org.apache.karaf/apache-karaf/4.2.2/apache-karaf-4.2.2.zip'
}

private boolean file_exists(String path) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
//
// ============================================================================
// (C) Copyright Schalk W. Cronje 2013-2019
//
// This software is licensed under the Apache License 2.0
// See http://www.apache.org/licenses/LICENSE-2.0 for license details
//
// Unless required by applicable law or agreed to in writing, software distributed under the License is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and limitations under the License.
//
// ============================================================================
//

package org.ysb33r.gradle.ivypot

import groovy.transform.CompileStatic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class OfflineRepositorySync extends DefaultTask {
}.join('|')
}.curry(this))

inputs.properties.put('cached binaries' , { OfflineRepositorySync ors ->
inputs.properties.put('cached binaries', { OfflineRepositorySync ors ->
ors.binaries*.toString().join('')
}.curry(this))

Expand Down Expand Up @@ -110,6 +110,7 @@ class OfflineRepositorySync extends DefaultTask {
project.file(this.binaryRepoRoot).absoluteFile
}

@Internal
NamedDomainObjectContainer<BinaryRepository> getBinaryRepositories() {
this.binaryRepositories
}
Expand Down Expand Up @@ -137,6 +138,7 @@ class OfflineRepositorySync extends DefaultTask {
* @return A project configuration container with all of the named configurations. Does not
* return the {@code buildscript} configuration in here. The latter is made available directly to
*/
@Internal
Set<Configuration> getConfigurations() {
Set<Configuration> configurationSet = []
projectConfigurations.collect { Project p, List<Object> configs ->
Expand Down Expand Up @@ -253,6 +255,7 @@ class OfflineRepositorySync extends DefaultTask {
*
* @return A repository handler that Gradle users should be accustomed to.
*/
@Internal
RepositoryHandler getRepositories() {
this.repositories
}
Expand Down Expand Up @@ -282,6 +285,7 @@ class OfflineRepositorySync extends DefaultTask {
*
* @return Artifact pattern or null in case repoRoot has not been set.
*/
@Internal
String getArtifactPattern() {
repoRoot ? "${repoRoot}/${repoArtifactPattern}" : null
}
Expand All @@ -290,11 +294,11 @@ class OfflineRepositorySync extends DefaultTask {
List<BinaryArtifactDependency> getBinaries() {
List<DependencyHandlerExtension> handlers = [extBinaries]
handlers.addAll(
projectConfigurations.keySet().collect { Project p ->
(DependencyHandlerExtension) (
(ExtensionAware) p.dependencies).extensions.findByName(BinaryPotBasePlugin.EXTENSION_NAME
)
}.findAll { it != null }
projectConfigurations.keySet().collect { Project p ->
(DependencyHandlerExtension) (
(ExtensionAware) p.dependencies).extensions.findByName(BinaryPotBasePlugin.EXTENSION_NAME
)
}.findAll { it != null }
)

handlers.collectMany { DependencyHandlerExtension dhext ->
Expand Down Expand Up @@ -353,8 +357,8 @@ class OfflineRepositorySync extends DefaultTask {
}

private IvyDependency ivyDependency(Dependency dep) {
if(dep instanceof ModuleDependency) {
ModuleDependency modDep = (ModuleDependency)dep
if (dep instanceof ModuleDependency) {
ModuleDependency modDep = (ModuleDependency) dep
new IvyDependency(
organisation: dep.group,
module: dep.name,
Expand Down Expand Up @@ -400,11 +404,15 @@ class OfflineRepositorySync extends DefaultTask {
this.repositories.findAll { repo ->
repo.metaClass.respondsTo(repo, 'getRepositoryCredentials') && repo.credentials?.username && repo.credentials?.password
}.collect { repo ->
[
def ret = [
host : repo.url.host,
username: repo.credentials.username,
password: repo.credentials.password
] as Map<String, String>
if (repo.credentials.realm) {
ret['realm'] = it.credentials.realm
}
ret
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
//
// ============================================================================
// (C) Copyright Schalk W. Cronje 2013-2019
//
// This software is licensed under the Apache License 2.0
// See http://www.apache.org/licenses/LICENSE-2.0 for license details
//
// Unless required by applicable law or agreed to in writing, software distributed under the License is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and limitations under the License.
//
// ============================================================================
//

package org.ysb33r.gradle.ivypot.extensions

import groovy.transform.CompileStatic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class OfflineRepositoryExtension {
Configuration getConfiguration() {
def deps = [
createDependency("${GROOVY_GROUP}:groovy-ant:${groovyVersion}"),
createDependency("${GROOVY_GROUP}:groovy-xml:${groovyVersion}"),
createDependency("${IVY_GROUP}:ivy:${ivyVersion}")
]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
//
// ============================================================================
// (C) Copyright Schalk W. Cronje 2013-2019
//
// This software is licensed under the Apache License 2.0
// See http://www.apache.org/licenses/LICENSE-2.0 for license details
//
// Unless required by applicable law or agreed to in writing, software distributed under the License is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and limitations under the License.
//
// ============================================================================
//

package org.ysb33r.gradle.ivypot.internal

import groovy.transform.CompileStatic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
//
// ============================================================================
// (C) Copyright Schalk W. Cronje 2013-2019
//
// This software is licensed under the Apache License 2.0
// See http://www.apache.org/licenses/LICENSE-2.0 for license details
//
// Unless required by applicable law or agreed to in writing, software distributed under the License is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and limitations under the License.
//
// ============================================================================
//

package org.ysb33r.gradle.ivypot.internal

import groovy.transform.CompileStatic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class IvyUtils {
repositoryCredentials.each { repo ->
credentials(repo)
}

resolvers {
chain(name: REMOTECHAINNAME, returnFirst: true) {
repositories.each { repo ->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
//
// ============================================================================
// (C) Copyright Schalk W. Cronje 2013-2019
//
// This software is licensed under the Apache License 2.0
// See http://www.apache.org/licenses/LICENSE-2.0 for license details
//
// Unless required by applicable law or agreed to in writing, software distributed under the License is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and limitations under the License.
//
// ============================================================================
//

package org.ysb33r.gradle.ivypot.remote

import groovy.transform.CompileStatic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
//
// ============================================================================
// (C) Copyright Schalk W. Cronje 2013-2019
//
// This software is licensed under the Apache License 2.0
// See http://www.apache.org/licenses/LICENSE-2.0 for license details
//
// Unless required by applicable law or agreed to in writing, software distributed under the License is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and limitations under the License.
//
// ============================================================================
//

package org.ysb33r.gradle.ivypot.remote

import groovy.transform.CompileStatic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
//
// ============================================================================
// (C) Copyright Schalk W. Cronje 2013-2019
//
// This software is licensed under the Apache License 2.0
// See http://www.apache.org/licenses/LICENSE-2.0 for license details
//
// Unless required by applicable law or agreed to in writing, software distributed under the License is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and limitations under the License.
//
// ============================================================================
//

package org.ysb33r.gradle.ivypot.remote

import groovy.transform.CompileStatic
Expand Down
14 changes: 14 additions & 0 deletions src/main/groovy/org/ysb33r/gradle/ivypot/remote/Downloader.groovy
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
//
// ============================================================================
// (C) Copyright Schalk W. Cronje 2013-2019
//
// This software is licensed under the Apache License 2.0
// See http://www.apache.org/licenses/LICENSE-2.0 for license details
//
// Unless required by applicable law or agreed to in writing, software distributed under the License is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and limitations under the License.
//
// ============================================================================
//

package org.ysb33r.gradle.ivypot.remote

import groovy.transform.CompileStatic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
/**
* ============================================================================
* (C) Copyright Schalk W. Cronje 2013-2019
*
* This software is licensed under the Apache License 2.0
* See http://www.apache.org/licenses/LICENSE-2.0 for license details
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and limitations under the License.
*
* ============================================================================
*/
package org.ysb33r.gradle.ivypot.repositories.binary;

public interface BinaryArtifactDependency {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
//
// ============================================================================
// (C) Copyright Schalk W. Cronje 2013-2019
//
// This software is licensed under the Apache License 2.0
// See http://www.apache.org/licenses/LICENSE-2.0 for license details
//
// Unless required by applicable law or agreed to in writing, software distributed under the License is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and limitations under the License.
//
// ============================================================================
//

package org.ysb33r.gradle.ivypot.repositories.binary

import groovy.transform.CompileStatic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
/**
* ============================================================================
* (C) Copyright Schalk W. Cronje 2013-2019
*
* This software is licensed under the Apache License 2.0
* See http://www.apache.org/licenses/LICENSE-2.0 for license details
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and limitations under the License.
*
* ============================================================================
*/
package org.ysb33r.gradle.ivypot.repositories.binary;

import org.gradle.api.Named;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
//
// ============================================================================
// (C) Copyright Schalk W. Cronje 2013-2019
//
// This software is licensed under the Apache License 2.0
// See http://www.apache.org/licenses/LICENSE-2.0 for license details
//
// Unless required by applicable law or agreed to in writing, software distributed under the License is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and limitations under the License.
//
// ============================================================================
//

package org.ysb33r.gradle.ivypot.remote

import org.junit.Rule
Expand Down Expand Up @@ -77,6 +91,7 @@ class BinaryDownloaderSpec extends Specification {

then:
expectedFile.exists()
lastModified != expectedFile.lastModified()
// The Travis CI environment does not deal with lastModified correctly
lastModified != expectedFile.lastModified() || System.getenv('TRAVIS')
}
}
Loading

0 comments on commit 30ddd3e

Please sign in to comment.