ResourceModel model = findOrCreateModel(project);
// Used by ResourceKeyMigration in order to know that a project has already being migrated
model.setDeprecatedKey(project.getKey());
- // ugly, only for projects
- model.setLanguageKey(project.getLanguageKey());
+ // language is null for project since multi-language support
+ model.setLanguageKey(null);
// For views
if (project instanceof ResourceCopy) {
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.CharMatcher;
import com.google.common.io.Files;
-import org.apache.commons.lang.StringUtils;
import org.sonar.api.BatchComponent;
import org.sonar.api.CoreProperties;
import org.sonar.api.batch.SonarIndex;
import org.sonar.batch.index.ResourceKeyMigration;
import org.sonar.batch.scan.language.DefaultModuleLanguages;
import org.sonar.core.resource.ResourceDao;
-import org.sonar.core.resource.ResourceDto;
/**
* Index all files/directories of the module in SQ database and importing source code.
importSources(shouldImportSource, inputFile, sonarFile);
}
}
-
- updateModuleLanguage();
}
@VisibleForTesting
+ inputFile.encoding() + "'.", e);
}
}
-
- private void updateModuleLanguage() {
- if (module.getId() != null) {
- ResourceDto dto = resourceDao.getResource(module.getId());
- if (moduleLanguages.keys().size() == 1) {
- dto.setLanguage(moduleLanguages.keys().iterator().next());
- } else if (moduleLanguages.keys().size() > 1) {
- dto.setLanguage(StringUtils.join(moduleLanguages.keys(), ","));
- } else {
- dto.setLanguage(Project.NONE_LANGUAGE.getKey());
- }
- resourceDao.insertOrUpdate(dto);
- }
- }
}
<projects id="1001" scope="PRJ" qualifier="TRK" kee="foo" root_id="[null]"
name="Foo" long_name="Foo" description="some description"
- enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" created_at="[null]" path="[null]" deprecated_kee="foo"/>
+ enabled="true" language="[null]" copy_resource_id="[null]" person_id="[null]" created_at="[null]" path="[null]" deprecated_kee="foo"/>
<!-- old snapshot -->
<snapshots purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" id="3001" project_id="1001" parent_snapshot_id="[null]" root_project_id="1001" root_snapshot_id="[null]"
<!-- new project -->
<projects id="1001" scope="PRJ" qualifier="TRK" kee="foo" root_id="[null]"
name="Foo" long_name="Foo" description="some description"
- enabled="true" language="java" copy_resource_id="10" person_id="[null]" path="[null]" deprecated_kee="foo" />
+ enabled="true" language="[null]" copy_resource_id="10" person_id="[null]" path="[null]" deprecated_kee="foo" />
<snapshots purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" id="3001" project_id="1001" parent_snapshot_id="[null]" root_project_id="1001" root_snapshot_id="[null]"
scope="PRJ" qualifier="TRK" created_at="2010-12-25 00:00:00.00" build_date="2010-12-25 00:00:00.00" version="[null]" path=""
<!-- new project -->
<projects id="1001" scope="PRJ" qualifier="TRK" kee="foo" root_id="[null]"
name="Foo" long_name="Foo" description="some description"
- enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" path="[null]" deprecated_kee="foo" />
+ enabled="true" language="[null]" copy_resource_id="[null]" person_id="[null]" path="[null]" deprecated_kee="foo" />
<projects id="1002" scope="DIR" qualifier="DIR" kee="foo:src/main/java/org/foo" root_id="1001"
name="src/main/java/org/foo" long_name="src/main/java/org/foo" description="[null]"
<!-- new project -->
<projects id="1001" scope="PRJ" qualifier="TRK" kee="foo" root_id="[null]"
name="Foo" long_name="Foo" description="some description"
- enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" path="[null]" deprecated_kee="foo" />
+ enabled="true" language="[null]" copy_resource_id="[null]" person_id="[null]" path="[null]" deprecated_kee="foo" />
<projects id="1002" scope="PRJ" qualifier="LIB" kee="junit:junit" root_id="[null]"
name="junit:junit" long_name="junit:junit" description="[null]"
<!-- new project -->
<projects id="1001" scope="PRJ" qualifier="TRK" kee="root" root_id="[null]"
name="Root" long_name="Root" description="[null]"
- enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" path="[null]" deprecated_kee="root" />
+ enabled="true" language="[null]" copy_resource_id="[null]" person_id="[null]" path="[null]" deprecated_kee="root" />
<projects id="1002" scope="PRJ" qualifier="BRC" kee="a" root_id="1001"
name="A" long_name="A" description="[null]"
- enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" path="moduleA" deprecated_kee="a" />
+ enabled="true" language="[null]" copy_resource_id="[null]" person_id="[null]" path="moduleA" deprecated_kee="a" />
<projects id="1003" scope="PRJ" qualifier="BRC" kee="b" root_id="1001"
name="B" long_name="B" description="[null]"
- enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" path="moduleB" deprecated_kee="b" />
+ enabled="true" language="[null]" copy_resource_id="[null]" person_id="[null]" path="moduleB" deprecated_kee="b" />
<projects id="1004" scope="PRJ" qualifier="BRC" kee="b1" root_id="1001"
name="B1" long_name="B1" description="[null]"
- enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" path="moduleB1" deprecated_kee="b1" />
+ enabled="true" language="[null]" copy_resource_id="[null]" person_id="[null]" path="moduleB1" deprecated_kee="b1" />
<snapshots purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" id="3001" project_id="1001" root_project_id="1001" parent_snapshot_id="[null]" root_snapshot_id="[null]"
<!-- new project -->
<projects id="1001" scope="PRJ" qualifier="TRK" kee="foo" root_id="[null]"
name="Foo" long_name="Foo" description="some description"
- enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" path="[null]" deprecated_kee="foo" />
+ enabled="true" language="[null]" copy_resource_id="[null]" person_id="[null]" path="[null]" deprecated_kee="foo" />
<snapshots purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" id="3001" project_id="1001" parent_snapshot_id="[null]" root_project_id="1001" root_snapshot_id="[null]"
scope="PRJ" qualifier="TRK" created_at="2010-12-25 00:00:00.00" build_date="2010-12-25 00:00:00.00" version="[null]" path=""
<projects id="1001" scope="PRJ" qualifier="TRK" kee="foo" root_id="[null]"
name="new name" long_name="new name" description="new description"
- enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" path="[null]" deprecated_kee="foo" />
+ enabled="true" language="[null]" copy_resource_id="[null]" person_id="[null]" path="[null]" deprecated_kee="foo" />
<!-- old snapshot -->
<snapshots purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" id="3001" project_id="1001" parent_snapshot_id="[null]" root_project_id="1001" root_snapshot_id="[null]"