Skip to content

Commit

Permalink
Merge branch 'hotfix/0.7.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
johnrengelman committed Apr 11, 2013
2 parents 27bdfb5 + c3702d4 commit 7158981
Show file tree
Hide file tree
Showing 16 changed files with 160 additions and 27 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ How to use
}
}
dependencies {
classpath 'org.gradle.plugins:shadow:0.7.2'
classpath 'org.gradle.plugins:shadow:0.7.3'
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
currentVersion=0.7.2
currentVersion=0.7.3
bintray_repo=gradle-plugins
bintray_package=org.gradle.plugins:shadow
13 changes: 13 additions & 0 deletions it/appending-transformer/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import org.gradle.api.plugins.shadow.transformers.AppendingTransformer

dependencies {
compile 'org.apache.maven.its.shade.at:one:0.1'
compile 'org.apache.maven.its.shade.at:two:0.1'
}

shadow {
artifactAttached = false
transformer(AppendingTransformer) {
resource = 'META-INF/services/org.apache.maven.Shade'
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
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.
-->

<project>
<modelVersion>4.0.0</modelVersion>

<groupId>org.apache.maven.its.shade.at</groupId>
<artifactId>one</artifactId>
<version>0.1</version>
<packaging>jar</packaging>

<distributionManagement>
<repository>
<id>maven-core-it</id>
<url>file:///${basedir}/repo</url>
</repository>
</distributionManagement>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>org.apache.maven.its.shade.at</groupId>
<artifactId>one</artifactId>
<version>0.1</version>
<versioning>
<versions>
<version>0.1</version>
</versions>
<lastUpdated>20100321160306</lastUpdated>
</versioning>
</metadata>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
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.
-->

<project>
<modelVersion>4.0.0</modelVersion>

<groupId>org.apache.maven.its.shade.at</groupId>
<artifactId>two</artifactId>
<version>0.1</version>
<packaging>jar</packaging>

<distributionManagement>
<repository>
<id>maven-core-it</id>
<url>file:///${basedir}/repo</url>
</repository>
</distributionManagement>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>org.apache.maven.its.shade.at</groupId>
<artifactId>two</artifactId>
<version>0.1</version>
<versioning>
<versions>
<version>0.1</version>
</versions>
<lastUpdated>20100321160331</lastUpdated>
</versioning>
</metadata>
23 changes: 23 additions & 0 deletions it/appending-transformer/verify.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{ project ->

def jar = file("${buildDir}/libs/${project.name}-${currentVersion}.jar")

assert jar.exists()

def jarFile = zipTree(jar)

def shadeService = jarFile.matching {
include { fileTreeElement ->
fileTreeElement.relativePath.toString() == 'META-INF/services/org.apache.maven.Shade'
}
}.files as List

assert shadeService.size() == 1

def serviceText = shadeService[0].text
def providers = serviceText.split('(\r\n)|(\r)|(\n)')
assert providers.size() == 2
assert providers[0] == 'one # NOTE: No newline terminates this line/file'
assert providers[1] == 'two # NOTE: No newline terminates this line/file'

}
2 changes: 1 addition & 1 deletion it/filter-artifact-contents-shortcut/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ shadow {
exclude 'org/apache/*'
exclude 'org/apache/maven/b/'
}
include 'META-INF/MANIFEST.MF'
// include 'META-INF/MANIFEST.MF'
exclude 'org/*'
exclude 'META-INF/**/'
}
28 changes: 14 additions & 14 deletions it/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
include 'archivesBaseName'
include 'archivesBaseName-attached'
include 'artifact-includes-excludes'
include 'artifact-includes-excludes-shortcut'
include 'baseName'
include 'baseName-attached'
include 'filter-artifact-contents'
include 'implicit-inclusion-of-project-artifact'
include 'manifest-retained'
include 'manifest-transformed'
include 'non-runtime-scope-excluded'
include 'pom-packaging'
include 'services-resource-transformer'
include 'xml-transformer-ignores-dtd'
import groovy.io.FileType

def path = [] as LinkedList
rootDir.traverse(
type: FileType.FILES,
nameFilter: ~/.+\.gradle/,
maxDepth: 3,
preDir: { path << it.name },
postDir: { path.removeLast() }
) {
if (path) {
include path.join(':')
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,13 @@ class ShadowTaskExtension {

ShadowTaskExtension filter(String artifact, Closure c) {
if (!artifact) throw new GradleException('Must specify artifact for filter!')
ArchiveFilter filter = new ArchiveFilter(artifact: artifact)
ArchiveFilter filter = filters.find { it.artifact == artifact } ?: new ArchiveFilter(artifact: artifact)
c.delegate = filter
c.resolveStrategy = Closure.DELEGATE_ONLY
c()
filters << filter
if (!filters.contains(filter)) {
filters << filter
}
this
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,7 @@ interface Filter {

boolean isFiltered(String classFile)

boolean isSpecificallyIncluded(String classFile)

void finished()
}
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,10 @@ class DefaultCaster implements Caster {
}

private boolean isFiltered(List<Filter> filters, String name) {
for (Filter filter : filters) {
if (filter.isFiltered(name)) {
return true
}
}

return false
// if (filters.any { it.isSpecificallyIncluded(name)}) {
// return false
// }
return filters.any { it.isFiltered(name) }
}

private boolean resourceTransformed(List<Transformer> resourceTransformers, String name, InputStream is,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class AppendingTransformer implements Transformer {

void transform(String path, InputStream is, List<Relocator> relocators) {
IOUtil.copy(is, data)
data.write('\n')
data.write('\n'.bytes)

is.close()
}
Expand Down

0 comments on commit 7158981

Please sign in to comment.