Skip to content
This repository was archived by the owner on Mar 6, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ repositories {
dependencies {
compile gradleApi()
compile localGroovy()
// compile 'com.android.tools.build:gradle:2.3.0'
compile 'com.android.tools.build:gradle:2.2.3'
compile 'com.android.tools.build:transform-api:1.5.0'
compile 'com.squareup:javapoet:1.8.0'
compile 'org.jooq:joor:0.9.6'
}
}
Empty file modified gradlew
100644 → 100755
Empty file.
32 changes: 18 additions & 14 deletions src/main/groovy/me/vigi/fataar/ExplodedHelper.groovy
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
package me.vigi.fataar

import org.gradle.api.Project
import org.gradle.api.artifacts.ResolvedArtifact

/**
* Created by Vigi on 2017/1/20.
*/
class ExplodedHelper {

public static void processIntoJars(Project project,
Collection<AndroidArchiveLibrary> androidLibraries, Collection<File> jarFiles,
Collection<AndroidArchiveLibrary> androidLibraries, Collection<ResolvedArtifact> jarFiles,
File folderOut) {
for (androidLibrary in androidLibraries) {
if (!androidLibrary.rootFolder.exists()) {
println 'fat-aar-->[warning]' + androidLibrary.rootFolder + ' not found!'
continue
}
// println 'fat-aar-->copy aar from: ' + androidLibrary.rootFolder
def prefix = androidLibrary.name + '-' + androidLibrary.version
def prefix = androidLibrary.group + '-' + androidLibrary.name + '-' + androidLibrary.version
project.copy {
from(androidLibrary.classesJarFile)
into folderOut
Expand All @@ -28,23 +29,26 @@ class ExplodedHelper {
rename { prefix + '-' + it }
}
}
for (jarFile in jarFiles) {
if (!jarFile.exists()) {
println 'fat-aar-->[warning]' + jarFile + ' not found!'
for (ResolvedArtifact jarFile in jarFiles) {
if (!jarFile.file.exists()) {
println 'fat-aar-->[warning] ' + jarFile.file + ' not found!'
continue
}
def id = jarFile.getModuleVersion().getId()
def prefix = id.group + '-' + id.name + '-' + id.version
// println 'fat-aar-->copy jar from: ' + jarFile
project.copy {
from(jarFile)
from(jarFile.file)
into folderOut
rename { prefix + '-' + it }
}
}
}

public static void processIntoClasses(Project project,
Collection<AndroidArchiveLibrary> androidLibraries, Collection<File> jarFiles,
Collection<AndroidArchiveLibrary> androidLibraries, Collection<ResolvedArtifact> jarFiles,
File folderOut) {
Collection<File> allJarFiles = new ArrayList<>()
Collection<ResolvedArtifact> allJarFiles = new ArrayList<>()
for (androidLibrary in androidLibraries) {
if (!androidLibrary.rootFolder.exists()) {
println 'fat-aar-->[warning]' + androidLibrary.rootFolder + ' not found!'
Expand All @@ -53,17 +57,17 @@ class ExplodedHelper {
allJarFiles.add(androidLibrary.classesJarFile)
allJarFiles.addAll(androidLibrary.localJars)
}
for (jarFile in jarFiles) {
if (!jarFile.exists()) {
println 'fat-aar-->[warning]' + jarFile + ' not found!'
for (ResolvedArtifact jarFile in jarFiles) {
if (!jarFile.file.exists()) {
println 'fat-aar-->[warning] ' + jarFile.file + ' not found!'
continue
}
allJarFiles.add(jarFile)
}
for (jarFile in allJarFiles) {
// println 'fat-aar-->copy classes from: ' + jarFile
for (ResolvedArtifact jarFile in allJarFiles) {
// println 'fat-aar-->copy classes from: ' + jarFile.file
project.copy {
from project.zipTree(jarFile)
from project.zipTree(jarFile.file)
into folderOut
include '**/*.class'
exclude 'META-INF/'
Expand Down
2 changes: 1 addition & 1 deletion src/main/groovy/me/vigi/fataar/FatLibraryPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class FatLibraryPlugin implements Plugin<Project> {
processor.addAndroidArchiveLibrary(archiveLibrary)
}
if ('jar'.equals(artifact.type)) {
processor.addJarFile(artifact.file)
processor.addJarFile(artifact)
}
}
processor.processVariant()
Expand Down
5 changes: 3 additions & 2 deletions src/main/groovy/me/vigi/fataar/VariantProcessor.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package me.vigi.fataar

import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.artifacts.ResolvedArtifact

/**
* Created by Vigi on 2017/2/24.
Expand All @@ -14,7 +15,7 @@ class VariantProcessor {

private Collection<AndroidArchiveLibrary> mAndroidArchiveLibraries = new ArrayList<>()

private Collection<File> mJarFiles = new ArrayList<>()
private Collection<ResolvedArtifact> mJarFiles = new ArrayList<>()

public VariantProcessor(Project project, variant) {
mProject = project
Expand All @@ -25,7 +26,7 @@ class VariantProcessor {
mAndroidArchiveLibraries.add(library)
}

public void addJarFile(File jar) {
public void addJarFile(ResolvedArtifact jar) {
mJarFiles.add(jar)
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/me/vigi/fataar/TestTransform.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public Set<QualifiedContent.ContentType> getInputTypes() {
}

@Override
public Set<? super QualifiedContent.Scope> getScopes() {
public Set<QualifiedContent.Scope> getScopes() {
return ImmutableSet.of();
}

@Override
public Set<? super QualifiedContent.Scope> getReferencedScopes() {
public Set<QualifiedContent.Scope> getReferencedScopes() {
return ImmutableSet.of(
// QualifiedContent.Scope.PROJECT, // current project classes dir
// QualifiedContent.Scope.PROJECT_LOCAL_DEPS, // local jars
Expand Down